"""
MAESS备份系统常量定义
"""


# 备份类型
class BackupType:
    """备份类型枚举"""
    FULL = "full"  # 完整备份
    DATABASE = "database"  # 数据库备份
    REDIS = "redis"  # Redis备份
    FILESYSTEM = "filesystem"  # 文件系统备份


# 备份状态
class BackupStatus:
    """备份状态枚举"""
    IN_PROGRESS = "in_progress"  # 备份中
    COMPLETED = "completed"  # 备份完成
    FAILED = "failed"  # 备份失败
    PARTIAL = "partial"  # 部分完成


# 恢复模式
class RestoreMode:
    """恢复模式枚举"""
    FULL = "full"  # 完整恢复
    DATABASE = "database"  # 仅恢复数据库
    REDIS = "redis"  # 仅恢复Redis
    FILESYSTEM = "filesystem"  # 仅恢复文件系统


# 备份配置键名
class BackupConfigKeys:
    """备份配置键名"""
    BACKUP_ROOT_DIR = "BACKUP_ROOT_DIR"
    BACKUP_RETENTION_DAYS = "BACKUP_RETENTION_DAYS"
    BACKUP_COMPRESS = "BACKUP_COMPRESS"
    BACKUP_MAX_SIZE_GB = "BACKUP_MAX_SIZE_GB"
    
    DB_BACKUP_ENABLED = "DB_BACKUP_ENABLED"
    DB_BACKUP_SCHEDULE = "DB_BACKUP_SCHEDULE"
    DB_BACKUP_TIMEOUT = "DB_BACKUP_TIMEOUT"
    
    REDIS_BACKUP_ENABLED = "REDIS_BACKUP_ENABLED"
    REDIS_BACKUP_SCHEDULE = "REDIS_BACKUP_SCHEDULE"
    
    FS_BACKUP_ENABLED = "FS_BACKUP_ENABLED"
    FS_BACKUP_SCHEDULE = "FS_BACKUP_SCHEDULE"
    FS_BACKUP_DIRS = "FS_BACKUP_DIRS"


# 默认配置值
class BackupDefaults:
    """备份默认配置"""
    # 基础默认值
    DEFAULT_BACKUP_ROOT_DIR = "/tmp/maess_backups"
    DEFAULT_RETENTION_DAYS = 7
    DEFAULT_COMPRESS = True
    DEFAULT_MAX_SIZE_GB = 50
    
    # 调度默认值
    DEFAULT_DB_BACKUP_SCHEDULE = "0 3 * * *"  # 每天凌晨3点
    DEFAULT_REDIS_BACKUP_SCHEDULE = "0 4 * * *"  # 每天凌晨4点
    DEFAULT_FS_BACKUP_SCHEDULE = "0 5 * * *"  # 每天凌晨5点
    
    # 默认备份目录
    DEFAULT_FS_BACKUP_DIRS = ["data", "uploads"]


# 备份文件扩展名
class BackupFileExt:
    """备份文件扩展名"""
    SQL = ".sql"
    JSON = ".json"
    TAR_GZ = ".tar.gz"
    BAK = ".bak"
    

# 备份进度消息
class BackupMessages:
    """备份相关消息常量"""
    BACKUP_STARTING = "备份开始"
    BACKUP_COMPLETED = "备份完成"
    BACKUP_FAILED = "备份失败"
    BACKUP_CANCELLED = "备份已取消"
    
    RESTORE_STARTING = "恢复开始"
    RESTORE_COMPLETED = "恢复完成"
    RESTORE_FAILED = "恢复失败"
    
    CLEANUP_STARTING = "清理过期备份开始"
    CLEANUP_COMPLETED = "清理过期备份完成"
    
    VALIDATION_STARTING = "验证备份开始"
    VALIDATION_COMPLETED = "验证备份完成"
    VALIDATION_FAILED = "验证备份失败"


# 备份大小单位
class SizeUnits:
    """大小单位"""
    BYTES = "B"
    KILOBYTES = "KB"
    MEGABYTES = "MB"
    GIGABYTES = "GB"
    TERABYTES = "TB"


# 备份任务优先级
class BackupPriority:
    """备份任务优先级"""
    HIGH = "high"
    MEDIUM = "medium"
    LOW = "low"


# API端点常量
class BackupAPIEndpoints:
    """备份API端点"""
    BACKUP_CREATE = "/api/backup/create"
    BACKUP_LIST = "/api/backup/list"
    BACKUP_INFO = "/api/backup/info/{backup_id}"
    BACKUP_DELETE = "/api/backup/delete/{backup_id}"
    BACKUP_RESTORE = "/api/backup/restore"
    BACKUP_VALIDATE = "/api/backup/validate/{backup_id}"
    
    SCHEDULE_LIST = "/api/backup/schedule/list"
    SCHEDULE_ADD = "/api/backup/schedule/add"
    SCHEDULE_REMOVE = "/api/backup/schedule/remove/{job_id}"
    SCHEDULE_STATUS = "/api/backup/schedule/status"
